package com.FrameWork.Common;


import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;

import com.FrameWork.Utils.Utils;
import com.SFA.R;

public class QueryStringHelper {

	public static String BuildQueryString(Context context,String[] keys,String[] values)
	{
		String RequestKey = context.getResources().getString(R.string.REQUESTKEY);
		PackageManager pm = context.getPackageManager();
		String Version= "";
		try
		{
			PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0);
			Version=pi.versionName;
		}
		catch (NameNotFoundException e)
		{
			e.printStackTrace();
		}
		String QueryString ="";
		String request = "";
		QueryString += "Version="+ Version;
		for(int i=0;i<keys.length;i++)
		{
			QueryString += "&" + keys[i] +"="+ values[i];
			request+=values[i];
		}
		RequestKey =Utils.GetStringForMD5(request+ RequestKey);
		QueryString+="&RequestKey=" + RequestKey;
		return QueryString;
	}
}
